package com.bwie.test;

import com.bwie.bean.Accountant;
import com.bwie.service.AccountantService;
import com.hq.common.utils.IOUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.io.File;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
public class Mytest {


    @Autowired
    AccountantService accountantService;

    @Test
    public void test3() throws Exception {
        List<String> strings = IOUtil.readTextFileByLine(
                new File("src\\test\\resources\\asaaa.csv")
        );

        Accountant accountant=null;
        for (int i = 0; i < strings.size(); i++) {
            String[] split = strings.get(i).split("|");

            //System.out.println(split.toString());
            accountant = new Accountant();
            accountant.setAname(split[0]);
          accountant.setSex(split[1]);
         accountant.setSheng(split[2]);
           accountant.setApply(split[3]);
         accountant.setTid(Integer.parseInt(split[4]));
           accountant.setPractice(split[6]);
          accountant.setNumber(split[7]);
           accountant.setAdate(split[8]);
          String s = accountant.toString();
            System.out.println(s);
            //accountantService.add(accountant);
        }


    }
}
